<template>
	<view class="container">
		<uni-row v-if="hasLogin === true">
			<uni-col :span="10" offset="1">
				<button type="primary" class="page-body-button" @click="go2page('user')">用户数据</button>
			</uni-col>
			<uni-col :span="10" offset="2">
				<button type="primary" class="page-body-button" @click="go2page('subscribe')">消息订阅</button>
			</uni-col>
		</uni-row>
	</view>
</template>

<script>
	import { mapState } from 'vuex'
	
	export default {
		computed: {
			...mapState(['hasLogin'])
		},
		data() {
			return {
				
			}
		},
		methods: {
			go2page(page) {
				uni.redirectTo({
					url: `/pages/${page}/index`,
				})
			}
		},
		onLoad() {
			if (!this.hasLogin) {
				// 跳转至登录界面
				uni.redirectTo({
					url: '/pages/login/index',
				})
			}
		}
	}
</script>

<style lang="scss"> 
	.container {
		padding: 20px;
		font-size: 14px;
		line-height: 24px;
	}
</style>
